//
//  HZMProductCVC.m
//  糖糖大魔王
//
//  Created by 韩震明 on 15/11/4.
//  Copyright © 2015年 韩震明. All rights reserved.
//

#import "HZMProductCVC.h"
#define WIDTH self.picImageView.frame.size.width
#define HEIGHT self.picImageView.frame.size.height

@implementation HZMProductCVC

- (void)dealloc
{
    [_picImageView release];
    [_bottomImageView release];
    [_priveImageView release];
    [_priceLabel release];
    [_titleLabel release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell
{
    self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 3 * self.contentView.frame.size.height / 4)];
    [self.contentView addSubview:self.picImageView];
    [_picImageView release];
    
    self.bottomImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 3 * self.contentView.frame.size.height / 4, self.contentView.frame.size.width, self.contentView.frame.size.height / 4)];
    [self.contentView addSubview:self.bottomImageView];
    [_bottomImageView release];
    
    self.priveImageView = [[UIImageView alloc] initWithFrame:CGRectMake(2 * WIDTH / 3, 4 * HEIGHT / 5, WIDTH - 2 * WIDTH / 3, HEIGHT / 5)];
    [self.picImageView addSubview:self.priveImageView];
    [_priveImageView release];
    self.priveImageView.layer.masksToBounds = YES;
    self.priveImageView.alpha = 0.8;
    self.priveImageView.image = [UIImage imageNamed:@"backOfTitle.png"];
    
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.priveImageView.frame.size.width, self.priveImageView.frame.size.height)];
    [self.priveImageView addSubview:self.priceLabel];
    [self.priceLabel release];
    self.priceLabel.font = [UIFont systemFontOfSize:13.0];
    self.priceLabel.textColor = [UIColor whiteColor];
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
    
    self.titleLabel = [[UILabel alloc] initWithFrame:self.bottomImageView.frame];
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel release];
    self.titleLabel.textColor = [UIColor grayColor];
    self.titleLabel.font = [UIFont systemFontOfSize:15.0];
}

@end
